import type { App, Directive } from 'vue'
import clamp from './clamp' // 超过规定字数显示省略号
import copy from './copy' // 复制
import debounce from './debounce' // 防抖函数
import hidden from './hidden' // 隐藏手机号中间4位
import longpress from './longpress' // 长按
import throttling from './throttling' // 节流

// 自定义指令
const directives: Record<string, Directive> = {
  clamp,
  copy,
  debounce,
  hidden,
  longpress,
  throttling
}

export default {
  install(app: App<Element>) {
    Object.keys(directives).forEach(key => {
      app.directive(key, directives[key])
    })
  }
}
